#include "concretesubject.h"

ConcreteSubject::ConcreteSubject()
{

}

ConcreteSubject::~ConcreteSubject()
{

}

void ConcreteSubject::attach(Observer *obj)
{
    m_List.push_back(obj);
}

void ConcreteSubject::detach(Observer *obj)
{
    m_List.remove(obj);
}

void ConcreteSubject::notify()
{
    for(auto node:m_List){
        int val = this->getState();
        node->update(val);
    }
}

void ConcreteSubject::setState(int state)
{
    m_state = state;
}

int ConcreteSubject::getState()
{
    return m_state;
}
